package com.github.chirspan.xaas.mybatis.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;

/**
 * @author ChenPan
 * @date 2018/6/29 14:09
 * description: 加载mybatis通用mapper和分页配置
 * PropertySource无法加载yaml格式文件
 * https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-yaml-shortcomings
 */
@Configuration
@Slf4j
//PropertySource无法加载yaml格式文件
@PropertySources(value = {@PropertySource(value = "classpath:mybatis-default.properties", ignoreResourceNotFound = true)})
public class MybatisDefaultConfig {

    /**
     * 加载YML格式自定义配置文件
     *
     * @return
     */
    /*@Bean
    public static PropertySourcesPlaceholderConfigurer mybatisConfigurer() {
        log.info(">>>>>加载mybatis默认配置：mybatis.yml");
        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
        yaml.setResources(new ClassPathResource("mybatis.yml"));
        configurer.setProperties(yaml.getObject());
        return configurer;
    }*/
}
